using System;
using System.Collections.Generic;
using System.Text;
using FlatRedBall.Math.Geometry;
using FlatRedBall.AI.Pathfinding;
using FlatRedBall.Input;
using FlatRedBall.IO;
using FlatRedBall.Instructions;
using FlatRedBall.Math.Splines;
using FlatRedBall.Utilities;
using BitmapFont = FlatRedBall.Graphics.BitmapFont;

using Cursor = FlatRedBall.Gui.Cursor;
using GuiManager = FlatRedBall.Gui.GuiManager;

#if XNA4
using Color = Microsoft.Xna.Framework.Color;
#else
using Color = Microsoft.Xna.Framework.Graphics.Color;
#endif

#if FRB_XNA || SILVERLIGHT
using Keys = Microsoft.Xna.Framework.Input.Keys;
using Vector3 = Microsoft.Xna.Framework.Vector3;
using Texture2D = Microsoft.Xna.Framework.Graphics.Texture2D;
using Microsoft.Xna.Framework.Media;
#endif

// Generated Usings
using FlatRedBall.Broadcasting;
using MultiplayerTD.Entities;
using MultiplayerTD.Factories;
using FlatRedBall;
using FlatRedBall.Graphics;

namespace MultiplayerTD.Screens
{
	public partial class MainMenu : Screen
	{
		// Generated Fields
		#if DEBUG
		static bool HasBeenLoadedWithGlobalContentManager = false;
		#endif
		
		private MultiplayerTD.Entities.Button StartGameButton;
		private MultiplayerTD.Entities.Button OptionsButton;
		private MultiplayerTD.Entities.Button ExitButton;
		private Layer Layer2D;
		public event FlatRedBall.Gui.WindowEvent ExitButtonClick;
		public event FlatRedBall.Gui.WindowEvent StartGameButtonClick;

		public MainMenu()
			: base("MainMenu")
		{
		}

        public override void Initialize(bool addToManagers)
        {
			// Generated Initialize
			LoadStaticContent(ContentManagerName);
			StartGameButton = new MultiplayerTD.Entities.Button(ContentManagerName, false);
			StartGameButton.Name = "StartGameButton";
			OptionsButton = new MultiplayerTD.Entities.Button(ContentManagerName, false);
			OptionsButton.Name = "OptionsButton";
			ExitButton = new MultiplayerTD.Entities.Button(ContentManagerName, false);
			ExitButton.Name = "ExitButton";

			ExitButton.Click += OnExitButtonClick;
			ExitButton.Click += OnExitButtonClickTunnel;
			StartGameButton.Click += OnStartGameButtonClick;
			StartGameButton.Click += OnStartGameButtonClickTunnel;
			
			this.NextScreen = typeof(MultiplayerTD.Screens.GameField).FullName;
			
			PostInitialize();
			base.Initialize(addToManagers);
			if (addToManagers)
			{
				AddToManagers();
			}
            Layer2D.Name = "Layer2D";
        }
        
// Generated AddToManagers
		public override void AddToManagers ()
		{
            Layer2D = SpriteManager.AddLayer();
			Layer2D.UsePixelCoordinates();
			AddToManagersBottomUp();
			CustomInitialize();
		}


		public override void Activity(bool firstTimeCalled)
		{
			// Generated Activity
			if (!IsPaused)
			{
				
				StartGameButton.Activity();
				OptionsButton.Activity();
				ExitButton.Activity();
			}
			else
			{
			}
			base.Activity(firstTimeCalled);
			if (!IsActivityFinished)
			{
				CustomActivity(firstTimeCalled);
			}


				// After Custom Activity
				
            
		}

		public override void Destroy()
		{
			// Generated Destroy
			if (StartGameButton != null)
			{
				StartGameButton.Destroy();
			}
			if (OptionsButton != null)
			{
				OptionsButton.Destroy();
			}
			if (ExitButton != null)
			{
				ExitButton.Destroy();
			}
			if (Layer2D != null)
			{
				SpriteManager.RemoveLayer(Layer2D);
			}
			

			base.Destroy();

			CustomDestroy();

		}

		// Generated Methods
public virtual void PostInitialize ()
{
	StartGameButton.DisplayText = "Start";
	OptionsButton.DisplayText = "Options";
	OptionsButton.Y = -35f;
	ExitButton.DisplayText = "Exit";
	ExitButton.Y = -70f;
}
public virtual void AddToManagersBottomUp ()
{
	StartGameButton.AddToManagers(Layer2D);
	StartGameButton.DisplayText = "Start";
	OptionsButton.AddToManagers(Layer2D);
	OptionsButton.DisplayText = "Options";
	OptionsButton.Y = -35f;
	ExitButton.AddToManagers(Layer2D);
	ExitButton.DisplayText = "Exit";
	ExitButton.Y = -70f;
}
public virtual void ConvertToManuallyUpdated ()
{
	StartGameButton.ConvertToManuallyUpdated();
	OptionsButton.ConvertToManuallyUpdated();
	ExitButton.ConvertToManuallyUpdated();
}
public static void LoadStaticContent (string contentManagerName)
{
	#if DEBUG
	if (contentManagerName == FlatRedBallServices.GlobalContentManager)
	{
		HasBeenLoadedWithGlobalContentManager = true;
	}
	else if (HasBeenLoadedWithGlobalContentManager)
	{
		throw new Exception("This type has been loaded with a Global content manager, then loaded with a non-global.  This can lead to a lot of bugs");
	}
	#endif
	MultiplayerTD.Entities.Button.LoadStaticContent(contentManagerName);
	CustomLoadStaticContent(contentManagerName);
}
object GetMember (string memberName)
{
	return null;
}


	}
}
